Some header cleanups
authorMatthias Clasen <mclasen@redhat.com>
Fri, 26 Nov 2010 01:39:53 +0000 (20:39 -0500)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 4 Dec 2010 14:39:47 +0000 (15:39 +0100)
Move GtkGradient to their own files, also move GtkBorder out of
gtkstyle.h, so that header can be all deprecated.

20 files changed:
docs/reference/gtk/gtk-docs.sgml
docs/reference/gtk/gtk3-sections.txt
gtk/Makefile.am
gtk/gtk.h
gtk/gtkborder.c [new file with mode: 0644]
gtk/gtkborder.h [new file with mode: 0644]
gtk/gtkcssprovider.c
gtk/gtkgradient.c [new file with mode: 0644]
gtk/gtkgradient.h [new file with mode: 0644]
gtk/gtksettings.c
gtk/gtkstyle.c
gtk/gtkstyle.h
gtk/gtkstylecontext.c
gtk/gtkstylecontext.h
gtk/gtkstyleproperties.c
gtk/gtkstyleproperties.h
gtk/gtksymboliccolor.c
gtk/gtksymboliccolor.h
gtk/gtkwidget.c
gtk/gtkwidget.h

index 505531a640d86b18de9b9f5189621cc9c71d6936..3671b672e963108d73dff3e7a7eb91f47efe4c6a 100644 (file)
     <xi:include href="xml/gtkaccelmap.xml" />
     <xi:include href="xml/gtkclipboard.xml" />
     <xi:include href="xml/gtkdnd.xml" />
-    <xi:include href="xml/gtkicontheme.xml" />
     <xi:include href="xml/gtkstock.xml" />
-    <xi:include href="xml/gtkiconfactory.xml" />
-    <xi:include href="xml/gtkrc.xml" />
     <xi:include href="xml/gtksettings.xml" />
     <xi:include href="xml/gtkbindings.xml" />
     <xi:include href="xml/gtkenums.xml" />
-    <xi:include href="xml/gtkstyle.xml" />
     <xi:include href="xml/gtkselection.xml" />
     <xi:include href="xml/gtktesting.xml" />
     <xi:include href="xml/filesystem.xml" />
 
   <part id="theming">
     <title>Theming in GTK+</title>
-    <xi:include href="xml/gtkwidgetpath.xml" />
-    <xi:include href="xml/gtkstyleprovider.xml" />
-    <xi:include href="xml/gtkstyleproperties.xml" />
     <xi:include href="xml/gtkstylecontext.xml" />
     <xi:include href="xml/gtkcssprovider.xml" />
+    <xi:include href="xml/gtkstyleprovider.xml" />
+    <xi:include href="xml/gtkstyleproperties.xml" />
     <xi:include href="xml/gtkthemingengine.xml" />
+    <xi:include href="xml/gtkwidgetpath.xml" />
+    <xi:include href="xml/gtksymboliccolor.xml" />
+    <xi:include href="xml/gtkgradient.xml" />
+    <xi:include href="xml/gtkicontheme.xml" />
+    <xi:include href="xml/gtkiconfactory.xml" />
+    <xi:include href="xml/gtkrc.xml" />
+    <xi:include href="xml/gtkstyle.xml" />
   </part>
 
   <part id="gtkobjects">
index f17596ae6cc8038805ddfa8dcfd5bfead4a17897..71202082f0afac7488e12df8c0e2ed5dd6d37561 100644 (file)
@@ -5314,33 +5314,6 @@ GTK_STYLE_PROVIDER_GET_IFACE
 gtk_style_provider_get_type
 </SECTION>
 
-<SECTION>
-<FILE>gtksymboliccolor</FILE>
-<TITLE>GtkSymbolicColor</TITLE>
-GtkSymbolicColor
-GtkGradient
-gtk_symbolic_color_new_literal
-gtk_symbolic_color_new_mix
-gtk_symbolic_color_new_name
-gtk_symbolic_color_new_shade
-gtk_symbolic_color_new_alpha
-gtk_symbolic_color_resolve
-gtk_symbolic_color_ref
-gtk_symbolic_color_unref
-gtk_gradient_new_linear
-gtk_gradient_new_radial
-gtk_gradient_add_color_stop
-gtk_gradient_resolve
-gtk_gradient_ref
-gtk_gradient_unref
-<SUBSECTION Standard>
-GTK_TYPE_GRADIENT
-GTK_TYPE_SYMBOLIC_COLOR
-<SUBSECTION Private>
-gtk_symbolic_color_get_type
-gtk_gradient_get_type
-</SECTION>
-
 <SECTION>
 <FILE>gtkstyleproperties</FILE>
 <TITLE>GtkStyleProperties</TITLE>
@@ -5446,9 +5419,12 @@ gtk_style_context_has_region
 gtk_style_context_list_regions
 gtk_style_context_set_screen
 gtk_style_context_set_state
-gtk_style_context_state_transition_start
-gtk_style_context_state_transition_stop
-gtk_style_context_state_transition_update
+
+<SUBSECTION>
+GtkBorder
+gtk_border_new
+gtk_border_copy
+gtk_border_free
 
 <SUBSECTION>
 gtk_render_arrow
@@ -5474,8 +5450,11 @@ GTK_STYLE_CONTEXT_CLASS
 GTK_STYLE_CONTEXT_GET_CLASS
 GTK_IS_STYLE_CONTEXT
 GTK_IS_STYLE_CONTEXT_CLASS
+GTK_TYPE_BORDER
+
 <SUBSECTION Private>
 gtk_style_context_get_type
+gtk_border_get_type
 </SECTION>
 
 <SECTION>
@@ -5531,6 +5510,43 @@ GTK_TYPE_THEMING_ENGINE
 gtk_theming_engine_get_type
 </SECTION>
 
+<SECTION>
+<FILE>gtksymboliccolor</FILE>
+<TITLE>GtkSymbolicColor</TITLE>
+GtkSymbolicColor
+gtk_symbolic_color_new_literal
+gtk_symbolic_color_new_name
+gtk_symbolic_color_new_shade
+gtk_symbolic_color_new_alpha
+gtk_symbolic_color_new_mix
+gtk_symbolic_color_ref
+gtk_symbolic_color_unref
+gtk_symbolic_color_resolve
+
+<SUBSECTION Standard>
+GTK_TYPE_SYMBOLIC_COLOR
+
+<SUBSECTION Private>
+gtk_symbolic_color_get_type
+</SECTION>
+
+<SECTION>
+<FILE>gtkgradient</FILE>
+<TITLE>GtkGradient</TITLE>
+GtkGradient
+gtk_gradient_new_linear
+gtk_gradient_new_radial
+gtk_gradient_add_color_stop
+gtk_gradient_ref
+gtk_gradient_unref
+gtk_gradient_resolve
+
+<SUBSECTION Standard>
+GTK_TYPE_GRADIENT
+
+gtk_gradient_get_type
+</SECTION>
+
 <SECTION>
 <FILE>gtkstyle</FILE>
 <TITLE>GtkStyle</TITLE>
@@ -5570,12 +5586,6 @@ gtk_paint_layout
 gtk_paint_resize_grip
 gtk_draw_insertion_cursor
 
-<SUBSECTION>
-GtkBorder
-gtk_border_new
-gtk_border_copy
-gtk_border_free
-
 <SUBSECTION>
 GtkRcProperty
 GtkRcPropertyParser
@@ -5588,10 +5598,8 @@ GTK_TYPE_STYLE
 GTK_STYLE_CLASS
 GTK_IS_STYLE_CLASS
 GTK_STYLE_GET_CLASS
-GTK_TYPE_BORDER
-<SUBSECTION Private>
+
 gtk_style_get_type
-gtk_border_get_type
 GtkThemeEngine
 </SECTION>
 
@@ -6012,6 +6020,7 @@ gtk_icon_info_get_builtin_pixbuf
 gtk_icon_info_load_icon
 gtk_icon_info_load_symbolic
 gtk_icon_info_load_symbolic_for_style
+gtk_icon_info_load_symbolic_for_context
 gtk_icon_info_set_raw_coordinates
 gtk_icon_info_get_embedded_rect
 gtk_icon_info_get_attach_points
index 14bde8ccfd522b25881b1169fb9fefde38c95587..e69d29337ca8218297dac0cc430bc8d1cb18e43b 100644 (file)
@@ -167,6 +167,7 @@ gtk_public_h_sources =          \
        gtkbbox.h               \
        gtkbin.h                \
        gtkbindings.h           \
+       gtkborder.h             \
        gtkbox.h                \
        gtkbuilder.h            \
        gtkbuildable.h          \
@@ -179,7 +180,7 @@ gtk_public_h_sources =          \
        gtkcellrenderercombo.h  \
        gtkcellrendererpixbuf.h \
        gtkcellrendererprogress.h \
-       gtkcellrendererspin.h   \
+       gtkcellrendererspin.h   \
        gtkcellrendererspinner.h\
        gtkcellrenderertext.h   \
        gtkcellrenderertoggle.h \
@@ -194,26 +195,27 @@ gtk_public_h_sources =          \
        gtkcomboboxtext.h       \
        gtkcontainer.h          \
        gtkcssprovider.h        \
-       gtkdebug.h              \
+       gtkdebug.h              \
        gtkdialog.h             \
        gtkdnd.h                \
        gtkdrawingarea.h        \
-       gtkeditable.h           \
+       gtkeditable.h           \
        gtkentry.h              \
        gtkentrybuffer.h        \
        gtkentrycompletion.h    \
        gtkenums.h              \
        gtkeventbox.h           \
        gtkexpander.h           \
-       gtkfilechooser.h        \
-       gtkfilechooserbutton.h  \
-       gtkfilechooserdialog.h  \
-       gtkfilechooserwidget.h  \
+       gtkfilechooser.h        \
+       gtkfilechooserbutton.h  \
+       gtkfilechooserdialog.h  \
+       gtkfilechooserwidget.h  \
        gtkfilefilter.h         \
        gtkfixed.h              \
        gtkfontbutton.h         \
        gtkfontsel.h            \
        gtkframe.h              \
+       gtkgradient.h           \
        gtkgrid.h               \
        gtkhandlebox.h          \
        gtkhbbox.h              \
@@ -235,7 +237,7 @@ gtk_public_h_sources =          \
        gtkinfobar.h            \
        gtkinvisible.h          \
        gtklabel.h              \
-       gtklayout.h             \
+       gtklayout.h             \
        gtklinkbutton.h         \
        gtkliststore.h          \
        gtkmain.h               \
@@ -247,7 +249,7 @@ gtk_public_h_sources =          \
        gtkmessagedialog.h      \
        gtkmisc.h               \
        gtkmodules.h            \
-       gtkmountoperation.h     \
+       gtkmountoperation.h     \
        gtknotebook.h           \
        gtkoffscreenwindow.h    \
        gtkorientable.h         \
@@ -257,7 +259,7 @@ gtk_public_h_sources =          \
        gtkplug.h               \
        gtkprintcontext.h       \
        gtkprintoperation.h     \
-       gtkprintoperationpreview.h      \
+       gtkprintoperationpreview.h \
        gtkprintsettings.h      \
        gtkprogressbar.h        \
        gtkradioaction.h        \
@@ -269,13 +271,13 @@ gtk_public_h_sources =          \
        gtkrecentaction.h       \
        gtkrecentchooser.h      \
        gtkrecentchooserdialog.h \
-       gtkrecentchoosermenu.h  \
+       gtkrecentchoosermenu.h  \
        gtkrecentchooserwidget.h \
-       gtkrecentfilter.h       \
+       gtkrecentfilter.h       \
        gtkrecentmanager.h      \
        gtkscale.h              \
        gtkscalebutton.h        \
-       gtkscrollable.h         \
+       gtkscrollable.h         \
        gtkscrollbar.h          \
        gtkscrolledwindow.h     \
        gtkselection.h          \
@@ -299,7 +301,7 @@ gtk_public_h_sources =          \
        gtkswitch.h             \
        gtksymboliccolor.h      \
        gtktable.h              \
-       gtktearoffmenuitem.h    \
+       gtktearoffmenuitem.h    \
        gtktestutils.h          \
        gtktextbuffer.h         \
        gtktextbufferrichtext.h \
@@ -461,6 +463,7 @@ gtk_base_c_sources =            \
        gtkbbox.c               \
        gtkbin.c                \
        gtkbindings.c           \
+       gtkborder.c             \
        gtkbox.c                \
        gtkbuildable.c          \
        gtkbuilder.c            \
@@ -490,7 +493,7 @@ gtk_base_c_sources =            \
        gtkcssprovider.c        \
        gtkdialog.c             \
        gtkdrawingarea.c        \
-       gtkeditable.c           \
+       gtkeditable.c           \
        gtkentry.c              \
        gtkentrybuffer.c        \
        gtkentrycompletion.c    \
@@ -508,9 +511,10 @@ gtk_base_c_sources =            \
        gtkfilesystem.c         \
        gtkfilesystemmodel.c    \
        gtkfixed.c              \
-       gtkfontbutton.c         \
-       gtkfontsel.c            \
+       gtkfontbutton.c         \
+       gtkfontsel.c            \
        gtkframe.c              \
+       gtkgradient.c           \
        gtkgrid.c               \
        gtkhandlebox.c          \
        gtkhbbox.c              \
@@ -549,7 +553,7 @@ gtk_base_c_sources =            \
        gtkmisc.c               \
        gtkmnemonichash.c       \
        gtkmodules.c            \
-       gtkmountoperation.c     \
+       gtkmountoperation.c     \
        gtknotebook.c           \
        gtkoffscreenwindow.c    \
        gtkorientable.c         \
@@ -561,7 +565,7 @@ gtk_base_c_sources =            \
        gtkplug.c               \
        gtkprintcontext.c       \
        gtkprintoperation.c     \
-       gtkprintoperationpreview.c      \
+       gtkprintoperationpreview.c \
        gtkprintsettings.c      \
        gtkprintutils.c         \
        gtkprogressbar.c        \
@@ -570,20 +574,20 @@ gtk_base_c_sources =            \
        gtkradiomenuitem.c      \
        gtkradiotoolbutton.c    \
        gtkrange.c              \
-       gtkrbtree.c             \
+       gtkrbtree.c             \
        gtkrc.c                 \
        gtkrecentaction.c       \
        gtkrecentchooserdefault.c \
-       gtkrecentchooserdialog.c \
-       gtkrecentchoosermenu.c  \
-       gtkrecentchooserwidget.c \
+       gtkrecentchooserdialog.c\
+       gtkrecentchoosermenu.c  \
+       gtkrecentchooserwidget.c\
        gtkrecentchooserutils.c \
        gtkrecentchooser.c      \
        gtkrecentfilter.c       \
        gtkrecentmanager.c      \
        gtkscale.c              \
        gtkscalebutton.c        \
-       gtkscrollable.c         \
+       gtkscrollable.c         \
        gtkscrollbar.c          \
        gtkscrolledwindow.c     \
        gtkselection.c          \
@@ -607,7 +611,7 @@ gtk_base_c_sources =            \
        gtkswitch.c             \
        gtksymboliccolor.c      \
        gtktable.c              \
-       gtktearoffmenuitem.c    \
+       gtktearoffmenuitem.c    \
        gtktestutils.c          \
        gtktextbtree.c          \
        gtktextbuffer.c         \
@@ -633,7 +637,7 @@ gtk_base_c_sources =            \
        gtktoolbar.c            \
        gtktoolbutton.c         \
        gtktoolitem.c           \
-       gtktoolitemgroup.c              \
+       gtktoolitemgroup.c      \
        gtktoolpalette.c        \
        gtktoolshell.c          \
        gtktooltip.c            \
@@ -660,7 +664,7 @@ gtk_base_c_sources =            \
        gtkvseparator.c         \
        gtkwidget.c             \
        gtkwidgetpath.c         \
-       gtkwindow-decorate.c    \
+       gtkwindow-decorate.c    \
        gtkwindow.c             \
        $(gtk_clipboard_dnd_c_sources) \
        $(gtk_appchooser_impl_c_sources)
index 36d9a33f047cb071faa74bcf1350f86eb5628230..3b1155d7fbc1aa8a9d3d5d38bb98910e8faa5238 100644 (file)
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -51,6 +51,7 @@
 #include <gtk/gtkbbox.h>
 #include <gtk/gtkbin.h>
 #include <gtk/gtkbindings.h>
+#include <gtk/gtkborder.h>
 #include <gtk/gtkbox.h>
 #include <gtk/gtkbuildable.h>
 #include <gtk/gtkbuilder.h>
@@ -98,6 +99,7 @@
 #include <gtk/gtkfontbutton.h>
 #include <gtk/gtkfontsel.h>
 #include <gtk/gtkframe.h>
+#include <gtk/gtkgradient.h>
 #include <gtk/gtkgrid.h>
 #include <gtk/gtkhandlebox.h>
 #include <gtk/gtkhbbox.h>
diff --git a/gtk/gtkborder.c b/gtk/gtkborder.c
new file mode 100644 (file)
index 0000000..6ea466a
--- /dev/null
@@ -0,0 +1,76 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
+ */
+
+#include "config.h"
+
+#include "gtkborder.h"
+
+/**
+ * gtk_border_new:
+ *
+ * Allocates a new #GtkBorder structure and initializes its elements to zero.
+ *
+ * Returns: a newly allocated #GtkBorder. Free with gtk_border_free()
+ *
+ * Since: 2.14
+ */
+GtkBorder *
+gtk_border_new (void)
+{
+  return g_slice_new0 (GtkBorder);
+}
+
+/**
+ * gtk_border_copy:
+ * @border_: a #GtkBorder
+ *
+ * Copies a #GtkBorder structure.
+ *
+ * Returns: a copy of @border_.
+ */
+GtkBorder *
+gtk_border_copy (const GtkBorder *border_)
+{
+  g_return_val_if_fail (border_ != NULL, NULL);
+
+  return g_slice_dup (GtkBorder, border_);
+}
+
+/**
+ * gtk_border_free:
+ * @border_: a #GtkBorder
+ *
+ * Frees a #GtkBorder structure.
+ */
+void
+gtk_border_free (GtkBorder *border_)
+{
+  g_slice_free (GtkBorder, border_);
+}
+
+G_DEFINE_BOXED_TYPE (GtkBorder, gtk_border,
+                     gtk_border_copy,
+                     gtk_border_free)
diff --git a/gtk/gtkborder.h b/gtk/gtkborder.h
new file mode 100644 (file)
index 0000000..51a5b7b
--- /dev/null
@@ -0,0 +1,68 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_BORDER_H__
+#define __GTK_BORDER_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+typedef struct _GtkBorder GtkBorder;
+
+#define GTK_TYPE_BORDER (gtk_border_get_type ())
+
+/**
+ * GtkBorder:
+ * @left: The width of the left border.
+ * @right: The width of the right border.
+ * @top: The width of the top border.
+ * @bottom: The width of the bottom border.
+ *
+ * A struct that specifies a border around a rectangular area that can
+ * be of different width on each side.
+ */
+struct _GtkBorder
+{
+  gint16 left;
+  gint16 right;
+  gint16 top;
+  gint16 bottom;
+};
+
+GType      gtk_border_get_type (void) G_GNUC_CONST;
+GtkBorder *gtk_border_new      (void) G_GNUC_MALLOC;
+GtkBorder *gtk_border_copy     (const GtkBorder *border_);
+void       gtk_border_free     (GtkBorder       *border_);
+
+
+G_END_DECLS
+
+#endif /* __GTK_BORDER_H__ */
index b2fde3981c1a42f90029be7011647ae6997afd81..76fd8665aeec53411c21de559993dcab9e056cbe 100644 (file)
@@ -36,9 +36,9 @@
  * @Title: GtkCssProvider
  * @See_also: #GtkStyleContext, #GtkStyleProvider
  *
- * #GtkCssProvider is an object implementing #GtkStyleProvider, it is able
- * to parse <ulink url="http://www.w3.org/TR/CSS2">CSS</ulink>-like input
- * in order to style widgets.
+ * GtkCssProvider is an object implementing the #GtkStyleProvider interface.
+ * It is able to parse <ulink url="http://www.w3.org/TR/CSS2">CSS</ulink>-like
+ * input in order to style widgets.
  *
  * <refsect2 id="gtkcssprovider-files">
  * <title>Default files</title>
diff --git a/gtk/gtkgradient.c b/gtk/gtkgradient.c
new file mode 100644 (file)
index 0000000..a19b8fe
--- /dev/null
@@ -0,0 +1,282 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+#include "gtkgradient.h"
+#include "gtkstyleproperties.h"
+#include "gtkintl.h"
+
+/**
+ * SECTION:gtkgradient
+ * @Short_description: Gradients
+ * @Title: GtkGradient
+ *
+ * GtkGradient is a boxed type that represents a gradient.
+ * It is the result of parsing a
+ * <link linkend="gtkcssprovider-gradients">gradient expression</link>.
+ * To obtain the gradient represented by a GtkGradient, it has to
+ * be resolved with gtk_gradient_resolve(), which replaces all
+ * symbolic color references by the colors they refer to (in a given
+ * context) and constructs a #cairo_pattern_t value.
+ *
+ * It is not normally necessary to deal directly with #GtkGradients,
+ * since they are mostly used behind the scenes by #GtkStyleContext and
+ * #GtkCssProvider.
+ */
+
+G_DEFINE_BOXED_TYPE (GtkGradient, gtk_gradient,
+                     gtk_gradient_ref, gtk_gradient_unref)
+
+typedef struct ColorStop ColorStop;
+
+struct ColorStop
+{
+  gdouble offset;
+  GtkSymbolicColor *color;
+};
+
+struct _GtkGradient
+{
+  gdouble x0;
+  gdouble y0;
+  gdouble x1;
+  gdouble y1;
+  gdouble radius0;
+  gdouble radius1;
+
+  GArray *stops;
+
+  guint ref_count;
+};
+
+/**
+ * gtk_gradient_new_linear:
+ * @x0: X coordinate of the starting point
+ * @y0: Y coordinate of the starting point
+ * @x1: X coordinate of the end point
+ * @y1: Y coordinate of the end point
+ *
+ * Creates a new linear gradient along the line defined by (x0, y0) and (x1, y1). Before using the gradient
+ * a number of stop colors must be added through gtk_gradient_add_color_stop().
+ *
+ * Returns: A newly created #GtkGradient
+ *
+ * Since: 3.0
+ **/
+GtkGradient *
+gtk_gradient_new_linear (gdouble x0,
+                         gdouble y0,
+                         gdouble x1,
+                         gdouble y1)
+{
+  GtkGradient *gradient;
+
+  gradient = g_slice_new (GtkGradient);
+  gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop));
+
+  gradient->x0 = x0;
+  gradient->y0 = y0;
+  gradient->x1 = x1;
+  gradient->y1 = y1;
+  gradient->radius0 = 0;
+  gradient->radius1 = 0;
+
+  gradient->ref_count = 1;
+
+  return gradient;
+}
+
+/**
+ * gtk_gradient_new_radial:
+ * @x0: X coordinate of the start circle
+ * @y0: Y coordinate of the start circle
+ * @radius0: radius of the start circle
+ * @x1: X coordinate of the end circle
+ * @y1: Y coordinate of the end circle
+ * @radius1: radius of the end circle
+ *
+ * Creates a new radial gradient along the two circles defined by (x0, y0, radius0) and
+ * (x1, y1, radius1). Before using the gradient a number of stop colors must be added
+ * through gtk_gradient_add_color_stop().
+ *
+ * Returns: A newly created #GtkGradient
+ *
+ * Since: 3.0
+ **/
+GtkGradient *
+gtk_gradient_new_radial (gdouble x0,
+                        gdouble y0,
+                        gdouble radius0,
+                        gdouble x1,
+                        gdouble y1,
+                        gdouble radius1)
+{
+  GtkGradient *gradient;
+
+  gradient = g_slice_new (GtkGradient);
+  gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop));
+
+  gradient->x0 = x0;
+  gradient->y0 = y0;
+  gradient->x1 = x1;
+  gradient->y1 = y1;
+  gradient->radius0 = radius0;
+  gradient->radius1 = radius1;
+
+  gradient->ref_count = 1;
+
+  return gradient;
+}
+
+/**
+ * gtk_gradient_add_color_stop:
+ * @gradient: a #GtkGradient
+ * @offset: offset for the color stop
+ * @color: color to use
+ *
+ * Adds a stop color to @gradient.
+ *
+ * Since: 3.0
+ **/
+void
+gtk_gradient_add_color_stop (GtkGradient      *gradient,
+                             gdouble           offset,
+                             GtkSymbolicColor *color)
+{
+  ColorStop stop;
+
+  g_return_if_fail (gradient != NULL);
+
+  stop.offset = offset;
+  stop.color = gtk_symbolic_color_ref (color);
+
+  g_array_append_val (gradient->stops, stop);
+}
+
+/**
+ * gtk_gradient_ref:
+ * @gradient: a #GtkGradient
+ *
+ * Increases the reference count of @gradient.
+ *
+ * Returns: The same @gradient
+ *
+ * Since: 3.0
+ **/
+GtkGradient *
+gtk_gradient_ref (GtkGradient *gradient)
+{
+  g_return_val_if_fail (gradient != NULL, NULL);
+
+  gradient->ref_count++;
+
+  return gradient;
+}
+
+/**
+ * gtk_gradient_unref:
+ * @gradient: a #GtkGradient
+ *
+ * Decreases the reference count of @gradient, freeing its memory
+ * if the reference count reaches 0.
+ *
+ * Since: 3.0
+ **/
+void
+gtk_gradient_unref (GtkGradient *gradient)
+{
+  g_return_if_fail (gradient != NULL);
+
+  gradient->ref_count--;
+
+  if (gradient->ref_count == 0)
+    {
+      guint i;
+
+      for (i = 0; i < gradient->stops->len; i++)
+        {
+          ColorStop *stop;
+
+          stop = &g_array_index (gradient->stops, ColorStop, i);
+          gtk_symbolic_color_unref (stop->color);
+        }
+
+      g_array_free (gradient->stops, TRUE);
+      g_slice_free (GtkGradient, gradient);
+    }
+}
+
+/**
+ * gtk_gradient_resolve:
+ * @gradient: a #GtkGradient
+ * @props: #GtkStyleProperties to use when resolving named colors
+ * @resolved_gradient: (out): return location for the resolved pattern
+ *
+ * If @gradient is resolvable, @resolved_gradient will be filled in
+ * with the resolved gradient as a cairo_pattern_t, and %TRUE will
+ * be returned. Generally, if @gradient can't be resolved, it is
+ * due to it being defined on top of a named color that doesn't
+ * exist in @props.
+ *
+ * Returns: %TRUE if the gradient has been resolved
+ *
+ * Since: 3.0
+ **/
+gboolean
+gtk_gradient_resolve (GtkGradient         *gradient,
+                      GtkStyleProperties  *props,
+                      cairo_pattern_t    **resolved_gradient)
+{
+  cairo_pattern_t *pattern;
+  guint i;
+
+  g_return_val_if_fail (gradient != NULL, FALSE);
+  g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE);
+  g_return_val_if_fail (resolved_gradient != NULL, FALSE);
+
+  if (gradient->radius0 == 0 && gradient->radius1 == 0)
+    pattern = cairo_pattern_create_linear (gradient->x0, gradient->y0,
+                                           gradient->x1, gradient->y1);
+  else
+    pattern = cairo_pattern_create_radial (gradient->x0, gradient->y0,
+                                           gradient->radius0,
+                                           gradient->x1, gradient->y1,
+                                           gradient->radius1);
+
+  for (i = 0; i < gradient->stops->len; i++)
+    {
+      ColorStop *stop;
+      GdkRGBA color;
+
+      stop = &g_array_index (gradient->stops, ColorStop, i);
+
+      if (!gtk_symbolic_color_resolve (stop->color, props, &color))
+        {
+          cairo_pattern_destroy (pattern);
+          return FALSE;
+        }
+
+      cairo_pattern_add_color_stop_rgba (pattern, stop->offset,
+                                         color.red, color.green,
+                                         color.blue, color.alpha);
+    }
+
+  *resolved_gradient = pattern;
+  return TRUE;
+}
diff --git a/gtk/gtkgradient.h b/gtk/gtkgradient.h
new file mode 100644 (file)
index 0000000..3e6b70f
--- /dev/null
@@ -0,0 +1,57 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GTK_GRADIENT_H__
+#define __GTK_GRADIENT_H__
+
+#include <gdk/gdk.h>
+#include <gtk/gtkstyleproperties.h>
+#include <gtk/gtksymboliccolor.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_GRADIENT (gtk_gradient_get_type ())
+
+GType         gtk_gradient_get_type       (void) G_GNUC_CONST;
+
+GtkGradient * gtk_gradient_new_linear     (gdouble              x0,
+                                           gdouble              y0,
+                                           gdouble              x1,
+                                           gdouble              y1);
+GtkGradient * gtk_gradient_new_radial     (gdouble              x0,
+                                           gdouble              y0,
+                                           gdouble              radius0,
+                                           gdouble              x1,
+                                           gdouble              y1,
+                                           gdouble              radius1);
+
+void          gtk_gradient_add_color_stop (GtkGradient         *gradient,
+                                           gdouble              offset,
+                                           GtkSymbolicColor    *color);
+
+GtkGradient * gtk_gradient_ref            (GtkGradient         *gradient);
+void          gtk_gradient_unref          (GtkGradient         *gradient);
+
+gboolean      gtk_gradient_resolve        (GtkGradient         *gradient,
+                                           GtkStyleProperties  *props,
+                                           cairo_pattern_t    **resolved_gradient);
+
+G_END_DECLS
+
+#endif /* __GTK_GRADIENT_H__ */
index 8b70038827acbcc7bb336e72c72265d477df3980..58fd2c1f4d4535f680c3113f0cfc182c84eb7ad6 100644 (file)
@@ -31,6 +31,7 @@
 #include "gtktypeutils.h"
 #include "gtkprivate.h"
 #include "gtkcssprovider.h"
+#include "gtksymboliccolor.h"
 #include "gtkversion.h"
 
 #ifdef GDK_WINDOWING_X11
index 3c8cdc5d9a38c6c8138d78a70e120a732e26f074..a59f1e4bb468d94cbe3ba17e6afce5252b0a1686 100644 (file)
@@ -41,6 +41,7 @@
 #include "gtkintl.h"
 #include "gtkdebug.h"
 #include "gtkspinner.h"
+#include "gtkborder.h"
 
 
 /**
@@ -60,7 +61,9 @@
  * Usually applications should not need to use or modify the #GtkStyle of their
  * widgets.
  *
+ * <warning>
  * In GTK+ 3.0, GtkStyle has been deprecated and replaced by #GtkStyleContext.
+ * </warning>
  */
 
 
@@ -4576,53 +4579,6 @@ gtk_paint_spinner (GtkStyle           *style,
   cairo_restore (cr);
 }
 
-/**
- * gtk_border_new:
- *
- * Allocates a new #GtkBorder structure and initializes its elements to zero.
- *
- * Returns: a new empty #GtkBorder. The newly allocated #GtkBorder should be
- *     freed with gtk_border_free()
- *
- * Since: 2.14
- **/
-GtkBorder *
-gtk_border_new (void)
-{
-  return g_slice_new0 (GtkBorder);
-}
-
-/**
- * gtk_border_copy:
- * @border_: a #GtkBorder.
- * @returns: a copy of @border_.
- *
- * Copies a #GtkBorder structure.
- **/
-GtkBorder *
-gtk_border_copy (const GtkBorder *border)
-{
-  g_return_val_if_fail (border != NULL, NULL);
-
-  return g_slice_dup (GtkBorder, border);
-}
-
-/**
- * gtk_border_free:
- * @border_: a #GtkBorder.
- * 
- * Frees a #GtkBorder structure.
- **/
-void
-gtk_border_free (GtkBorder *border)
-{
-  g_slice_free (GtkBorder, border);
-}
-
-G_DEFINE_BOXED_TYPE (GtkBorder, gtk_border,
-                     gtk_border_copy,
-                     gtk_border_free)
-
 typedef struct _CursorInfo CursorInfo;
 
 struct _CursorInfo
index 8bd38ec7554439c6cc02231b91ed8bc284dc37bd..3d44b1ffa7ca6092ad203f99acc9cb929e117d7b 100644 (file)
@@ -45,12 +45,9 @@ G_BEGIN_DECLS
 #define GTK_IS_STYLE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STYLE))
 #define GTK_STYLE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STYLE, GtkStyleClass))
 
-#define GTK_TYPE_BORDER             (gtk_border_get_type ())
-
 /* Some forward declarations needed to rationalize the header
  * files.
  */
-typedef struct _GtkBorder      GtkBorder;
 typedef struct _GtkStyle       GtkStyle;
 typedef struct _GtkStyleClass  GtkStyleClass;
 typedef struct _GtkThemeEngine GtkThemeEngine;
@@ -383,29 +380,6 @@ struct _GtkStyleClass
   void (*_gtk_reserved11) (void);
 };
 
-/**
- * GtkBorder:
- * @left: The width of the left border.
- * @right: The width of the right border.
- * @top: The width of the top border.
- * @bottom: The width of the bottom border.
- *
- * A struct that specifies a border around a rectangular area that can
- * be of different width on each side.
- */
-struct _GtkBorder
-{
-  gint16 left;
-  gint16 right;
-  gint16 top;
-  gint16 bottom;
-};
-
-GType      gtk_border_get_type (void) G_GNUC_CONST;
-GtkBorder *gtk_border_new      (void) G_GNUC_MALLOC;
-GtkBorder *gtk_border_copy     (const GtkBorder *border_);
-void       gtk_border_free     (GtkBorder       *border_);
-
 #if !defined(GTK_DISABLE_DEPRECATED) || defined(GTK_COMPILATION)
 
 GType     gtk_style_get_type                 (void) G_GNUC_CONST;
index 61d3b7b5cdca4f828c4bf54293b778d81c0894fa..190579d8920fc34010349d0abd5eaed994e841ce 100644 (file)
 #include "gtkwidget.h"
 #include "gtkwindow.h"
 #include "gtkprivate.h"
+#include "gtksymboliccolor.h"
 #include "gtkanimationdescription.h"
 #include "gtktimeline.h"
 
 /**
  * SECTION:gtkstylecontext
- * @Short_description: rendering UI elements
+ * @Short_description: Rendering UI elements
  * @Title: GtkStyleContext
- * @See_also:
  *
  * #GtkStyleContext is an object that stores styling information affecting
  * a widget defined by #GtkWidgetPath.
index 43f38939fd6a1921ecbde671292e1c98e9e180b2..2868c85a8cfea5a9ce0634ee2155ff07ed4427c1 100644 (file)
@@ -430,20 +430,6 @@ void           _gtk_style_context_coalesce_animation_areas   (GtkStyleContext *c
                                                               gint             rel_x,
                                                               gint             rel_y);
 
-/* Animation for state changes */
-void gtk_style_context_state_transition_start  (GtkStyleContext *context,
-                                                gpointer         identifier,
-                                                GtkWidget       *widget,
-                                                GtkStateType     state,
-                                                gboolean         value,
-                                                GdkRectangle    *rect);
-void gtk_style_context_state_transition_update (GtkStyleContext *context,
-                                                gpointer         identifier,
-                                                GdkRectangle    *rect,
-                                                GtkStateType     state);
-void gtk_style_context_state_transition_stop   (GtkStyleContext *context,
-                                                gpointer         identifier);
-
 void gtk_style_context_invalidate (GtkStyleContext *context);
 void gtk_style_context_reset_widgets (GdkScreen *screen);
 
index 5c54b21da88229efac890eafd9a758c9d23c20e2..49c05d944784e8f1183b5b70d3865d07168fa78c 100644 (file)
 
 #include "config.h"
 
+#include "gtkstyleproperties.h"
+
 #include <stdlib.h>
 #include <gobject/gvaluecollector.h>
 #include <cairo-gobject.h>
 
 #include "gtktypebuiltins.h"
 #include "gtkstyleprovider.h"
-#include "gtkstyleproperties.h"
+#include "gtksymboliccolor.h"
 #include "gtkprivate.h"
 #include "gtkthemingengine.h"
 #include "gtkanimationdescription.h"
+#include "gtkborder.h"
+#include "gtkgradient.h"
 #include "gtk9slice.h"
 #include "gtkintl.h"
 
index c41945997622d5b92f56875dec2394f4ec3b94f3..8a243b7f4f6f807ce046218e9ae2618b0308fc83 100644 (file)
@@ -22,8 +22,7 @@
 
 #include <glib-object.h>
 #include <gdk/gdk.h>
-#include "gtkenums.h"
-#include "gtksymboliccolor.h"
+#include <gtk/gtkenums.h>
 
 G_BEGIN_DECLS
 
@@ -37,6 +36,9 @@ G_BEGIN_DECLS
 typedef struct _GtkStyleProperties GtkStyleProperties;
 typedef struct _GtkStylePropertiesClass GtkStylePropertiesClass;
 
+typedef struct _GtkSymbolicColor GtkSymbolicColor;
+typedef struct _GtkGradient GtkGradient;
+
 struct _GtkStyleProperties
 {
   GObject parent_object;
@@ -101,13 +103,6 @@ void     gtk_style_properties_merge          (GtkStyleProperties       *props,
                                               const GtkStyleProperties *props_to_merge,
                                               gboolean                  replace);
 
-gboolean gtk_symbolic_color_resolve (GtkSymbolicColor    *color,
-                                    GtkStyleProperties  *props,
-                                     GdkRGBA             *resolved_color);
-gboolean gtk_gradient_resolve (GtkGradient         *gradient,
-                               GtkStyleProperties  *props,
-                               cairo_pattern_t    **resolved_gradient);
-
 G_END_DECLS
 
 #endif /* __GTK_STYLE_PROPERTIES_H__ */
index cb5a9191b0523e3cec2fc8eacff31005dea919d1..2345cfa3961c39db3cf2fb98f397973297754643 100644 (file)
 #include "gtkstyleproperties.h"
 #include "gtkintl.h"
 
+/**
+ * SECTION:gtksymboliccolor
+ * @Short_description: Symbolic colors
+ * @Title: GtkSymbolicColor
+ *
+ * GtkSymbolicColor is a boxed type that represents a symbolic color.
+ * It is the result of parsing a
+ * <link linkend="gtkcssprovider-symbolic-colors">color expression</link>.
+ * To obtain the color represented by a GtkSymbolicColor, it has to
+ * be resolved with gtk_symbolic_color_resolve(), which replaces all
+ * symbolic color references by the colors they refer to (in a given
+ * context) and evaluates mix, shade and other expressions, resulting
+ * in a #GdkRGBA value.
+ *
+ * It is not normally necessary to deal directly with #GtkSymbolicColors,
+ * since they are mostly used behind the scenes by #GtkStyleContext and
+ * #GtkCssProvider.
+ */
+
 G_DEFINE_BOXED_TYPE (GtkSymbolicColor, gtk_symbolic_color,
-                    gtk_symbolic_color_ref, gtk_symbolic_color_unref)
-G_DEFINE_BOXED_TYPE (GtkGradient, gtk_gradient,
-                     gtk_gradient_ref, gtk_gradient_unref)
+                     gtk_symbolic_color_ref, gtk_symbolic_color_unref)
 
 /* Symbolic colors */
 typedef enum {
@@ -61,28 +78,6 @@ struct _GtkSymbolicColor
   };
 };
 
-typedef struct ColorStop ColorStop;
-
-struct ColorStop
-{
-  gdouble offset;
-  GtkSymbolicColor *color;
-};
-
-struct _GtkGradient
-{
-  gdouble x0;
-  gdouble y0;
-  gdouble x1;
-  gdouble y1;
-  gdouble radius0;
-  gdouble radius1;
-
-  GArray *stops;
-
-  guint ref_count;
-};
-
 /**
  * gtk_symbolic_color_new_literal:
  * @color: a #GdkRGBA
@@ -561,220 +556,3 @@ gtk_symbolic_color_resolve (GtkSymbolicColor   *color,
 
   return FALSE;
 }
-
-/* GtkGradient */
-/**
- * gtk_gradient_new_linear:
- * @x0: X coordinate of the starting point
- * @y0: Y coordinate of the starting point
- * @x1: X coordinate of the end point
- * @y1: Y coordinate of the end point
- *
- * Creates a new linear gradient along the line defined by (x0, y0) and (x1, y1). Before using the gradient
- * a number of stop colors must be added through gtk_gradient_add_color_stop().
- *
- * Returns: A newly created #GtkGradient
- *
- * Since: 3.0
- **/
-GtkGradient *
-gtk_gradient_new_linear (gdouble x0,
-                         gdouble y0,
-                         gdouble x1,
-                         gdouble y1)
-{
-  GtkGradient *gradient;
-
-  gradient = g_slice_new (GtkGradient);
-  gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop));
-
-  gradient->x0 = x0;
-  gradient->y0 = y0;
-  gradient->x1 = x1;
-  gradient->y1 = y1;
-  gradient->radius0 = 0;
-  gradient->radius1 = 0;
-
-  gradient->ref_count = 1;
-
-  return gradient;
-}
-
-/**
- * gtk_gradient_new_radial:
- * @x0: X coordinate of the start circle
- * @y0: Y coordinate of the start circle
- * @radius0: radius of the start circle
- * @x1: X coordinate of the end circle
- * @y1: Y coordinate of the end circle
- * @radius1: radius of the end circle
- *
- * Creates a new radial gradient along the two circles defined by (x0, y0, radius0) and
- * (x1, y1, radius1). Before using the gradient a number of stop colors must be added
- * through gtk_gradient_add_color_stop().
- *
- * Returns: A newly created #GtkGradient
- *
- * Since: 3.0
- **/
-GtkGradient *
-gtk_gradient_new_radial (gdouble x0,
-                        gdouble y0,
-                        gdouble radius0,
-                        gdouble x1,
-                        gdouble y1,
-                        gdouble radius1)
-{
-  GtkGradient *gradient;
-
-  gradient = g_slice_new (GtkGradient);
-  gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop));
-
-  gradient->x0 = x0;
-  gradient->y0 = y0;
-  gradient->x1 = x1;
-  gradient->y1 = y1;
-  gradient->radius0 = radius0;
-  gradient->radius1 = radius1;
-
-  gradient->ref_count = 1;
-
-  return gradient;
-}
-
-/**
- * gtk_gradient_add_color_stop:
- * @gradient: a #GtkGradient
- * @offset: offset for the color stop
- * @color: color to use
- *
- * Adds a stop color to @gradient.
- *
- * Since: 3.0
- **/
-void
-gtk_gradient_add_color_stop (GtkGradient      *gradient,
-                             gdouble           offset,
-                             GtkSymbolicColor *color)
-{
-  ColorStop stop;
-
-  g_return_if_fail (gradient != NULL);
-
-  stop.offset = offset;
-  stop.color = gtk_symbolic_color_ref (color);
-
-  g_array_append_val (gradient->stops, stop);
-}
-
-/**
- * gtk_gradient_ref:
- * @gradient: a #GtkGradient
- *
- * Increases the reference count of @gradient.
- *
- * Returns: The same @gradient
- *
- * Since: 3.0
- **/
-GtkGradient *
-gtk_gradient_ref (GtkGradient *gradient)
-{
-  g_return_val_if_fail (gradient != NULL, NULL);
-
-  gradient->ref_count++;
-
-  return gradient;
-}
-
-/**
- * gtk_gradient_unref:
- * @gradient: a #GtkGradient
- *
- * Decreases the reference count of @gradient, freeing its memory
- * if the reference count reaches 0.
- *
- * Since: 3.0
- **/
-void
-gtk_gradient_unref (GtkGradient *gradient)
-{
-  g_return_if_fail (gradient != NULL);
-
-  gradient->ref_count--;
-
-  if (gradient->ref_count == 0)
-    {
-      guint i;
-
-      for (i = 0; i < gradient->stops->len; i++)
-        {
-          ColorStop *stop;
-
-          stop = &g_array_index (gradient->stops, ColorStop, i);
-          gtk_symbolic_color_unref (stop->color);
-        }
-
-      g_array_free (gradient->stops, TRUE);
-      g_slice_free (GtkGradient, gradient);
-    }
-}
-
-/**
- * gtk_gradient_resolve:
- * @gradient: a #GtkGradient
- * @props: #GtkStyleProperties to use when resolving named colors
- * @resolved_gradient: (out): return location for the resolved pattern
- *
- * If @gradient is resolvable, @resolved_gradient will be filled in
- * with the resolved gradient as a cairo_pattern_t, and %TRUE will
- * be returned. Generally, if @gradient can't be resolved, it is
- * due to it being defined on top of a named color that doesn't
- * exist in @props.
- *
- * Returns: %TRUE if the gradient has been resolved
- *
- * Since: 3.0
- **/
-gboolean
-gtk_gradient_resolve (GtkGradient         *gradient,
-                      GtkStyleProperties  *props,
-                      cairo_pattern_t    **resolved_gradient)
-{
-  cairo_pattern_t *pattern;
-  guint i;
-
-  g_return_val_if_fail (gradient != NULL, FALSE);
-  g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE);
-  g_return_val_if_fail (resolved_gradient != NULL, FALSE);
-
-  if (gradient->radius0 == 0 && gradient->radius1 == 0)
-    pattern = cairo_pattern_create_linear (gradient->x0, gradient->y0,
-                                           gradient->x1, gradient->y1);
-  else
-    pattern = cairo_pattern_create_radial (gradient->x0, gradient->y0,
-                                           gradient->radius0,
-                                           gradient->x1, gradient->y1,
-                                           gradient->radius1);
-
-  for (i = 0; i < gradient->stops->len; i++)
-    {
-      ColorStop *stop;
-      GdkRGBA color;
-
-      stop = &g_array_index (gradient->stops, ColorStop, i);
-
-      if (!gtk_symbolic_color_resolve (stop->color, props, &color))
-        {
-          cairo_pattern_destroy (pattern);
-          return FALSE;
-        }
-
-      cairo_pattern_add_color_stop_rgba (pattern, stop->offset,
-                                         color.red, color.green,
-                                         color.blue, color.alpha);
-    }
-
-  *resolved_gradient = pattern;
-  return TRUE;
-}
index fdcb915fe4687e75cf32c785e2078341e35e8b4f..462f086b09bb4b0e8caa2ae8435ef9307458b88d 100644 (file)
 #define __GTK_SYMBOLIC_COLOR_H__
 
 #include <gdk/gdk.h>
+#include <gtk/gtkstyleproperties.h>
 
 G_BEGIN_DECLS
 
-/* Dummy typedefs */
-typedef struct _GtkSymbolicColor GtkSymbolicColor;
-typedef struct _GtkGradient GtkGradient;
-
 #define GTK_TYPE_SYMBOLIC_COLOR (gtk_symbolic_color_get_type ())
-#define GTK_TYPE_GRADIENT (gtk_gradient_get_type ())
-
-GType gtk_symbolic_color_get_type (void) G_GNUC_CONST;
-GType gtk_gradient_get_type (void) G_GNUC_CONST;
-
-GtkSymbolicColor * gtk_symbolic_color_new_literal (const GdkRGBA    *color);
-GtkSymbolicColor * gtk_symbolic_color_new_name    (const gchar      *name);
-GtkSymbolicColor * gtk_symbolic_color_new_shade   (GtkSymbolicColor *color,
-                                                   gdouble           factor);
-GtkSymbolicColor * gtk_symbolic_color_new_alpha   (GtkSymbolicColor *color,
-                                                   gdouble           factor);
-GtkSymbolicColor * gtk_symbolic_color_new_mix     (GtkSymbolicColor *color1,
-                                                   GtkSymbolicColor *color2,
-                                                   gdouble           factor);
 
-GtkSymbolicColor * gtk_symbolic_color_ref   (GtkSymbolicColor *color);
-void               gtk_symbolic_color_unref (GtkSymbolicColor *color);
+GType              gtk_symbolic_color_get_type    (void) G_GNUC_CONST;
 
-GtkGradient * gtk_gradient_new_linear (gdouble x0,
-                                       gdouble y0,
-                                       gdouble x1,
-                                       gdouble y1);
-GtkGradient * gtk_gradient_new_radial (gdouble x0,
-                                      gdouble y0,
-                                      gdouble radius0,
-                                      gdouble x1,
-                                      gdouble y1,
-                                      gdouble radius1);
+GtkSymbolicColor * gtk_symbolic_color_new_literal (const GdkRGBA      *color);
+GtkSymbolicColor * gtk_symbolic_color_new_name    (const gchar        *name);
+GtkSymbolicColor * gtk_symbolic_color_new_shade   (GtkSymbolicColor   *color,
+                                                   gdouble             factor);
+GtkSymbolicColor * gtk_symbolic_color_new_alpha   (GtkSymbolicColor   *color,
+                                                   gdouble             factor);
+GtkSymbolicColor * gtk_symbolic_color_new_mix     (GtkSymbolicColor   *color1,
+                                                   GtkSymbolicColor   *color2,
+                                                   gdouble             factor);
 
-void gtk_gradient_add_color_stop (GtkGradient      *gradient,
-                                  gdouble           offset,
-                                  GtkSymbolicColor *color);
+GtkSymbolicColor * gtk_symbolic_color_ref         (GtkSymbolicColor   *color);
+void               gtk_symbolic_color_unref       (GtkSymbolicColor   *color);
 
-GtkGradient * gtk_gradient_ref   (GtkGradient *gradient);
-void          gtk_gradient_unref (GtkGradient *gradient);
+gboolean           gtk_symbolic_color_resolve     (GtkSymbolicColor   *color,
+                                                   GtkStyleProperties *props,
+                                                   GdkRGBA            *resolved_color);
 
 G_END_DECLS
 
index 324ed3d318da88592cee522b502ed5ad820b476b..1c0bfee7774dec059204928478720fa0b5db4333 100644 (file)
@@ -59,6 +59,7 @@
 #include "gtkbuilderprivate.h"
 #include "gtksizerequest.h"
 #include "gtkstylecontext.h"
+#include "gtksymboliccolor.h"
 #include "gtkcssprovider.h"
 #include "gtkanimationdescription.h"
 #include "gtkversion.h"
index 6240c643380c6793f42020e393f01ece4d330799..7f688555df6e36261ea7111b05654c5e6f268721 100644 (file)
@@ -35,6 +35,7 @@
 #include <gtk/gtkaccelgroup.h>
 #include <gtk/gtkadjustment.h>
 #include <gtk/gtkstyle.h>
+#include <gtk/gtkborder.h>
 #include <gtk/gtksettings.h>
 #include <gtk/gtkstylecontext.h>
 #include <gtk/gtkwidgetpath.h>